package xin.nick.roc.consumer.controller;

import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xin.nick.roc.consumer.anno.RpcClient;
import xin.nick.rpc.api.IUserService;

/**
 * @author Nick
 * @date 2021/7/4
 * @description
 */
@RestController
public class UserController {


    /**
     * 通过rpc注入
     */
    @RpcClient
    IUserService userService;

    @RequestMapping("/getUserById")
    public String getUserById(int id) {
        return JSON.toJSONString(userService.getById(id));
    }

}
